package com.demon.example.api;

import com.demon.example.ServiceName;
import com.demon.example.model.entity.UserPO;
import com.demon.framework.common.model.constants.ApiGateConstants;
import com.demon.framework.common.model.entity.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 用户相关接口
 * <p>
 * TODO FeignClient 不支持 @PostMapping 注解
 *
 * @author Demon-HY
 * @date 2020-7-23
 */
@Api(value = "用户相关接口")
@FeignClient(ServiceName.SERVER_NAME)
public interface IUserApi {

    @ApiOperation(value = "用户详情")
    @ApiImplicitParams({@ApiImplicitParam(name = "userId", value = "用户ID", paramType = "query", required = true)})
    @RequestMapping(value = ApiGateConstants.URI_INNER + "/get/by/id", method = RequestMethod.GET)
    ResultVO<UserPO> get(@RequestParam("userId") Long userId);

    @ApiOperation(value = "手机号查询用户详情")
    @ApiImplicitParams({@ApiImplicitParam(name = "phone", value = "手机号", paramType = "query", required = true)})
    @RequestMapping(value = ApiGateConstants.URI_INNER + "/get/by/phone", method = RequestMethod.GET)
    ResultVO<UserPO> getByPhone(@RequestParam("phone") String phone);
}
